<template>
  <div class="page-container" v-loading="pageLoading">
    <el-card>
      <template #header>
        <div class="card-header">
          <span>{{route.query?.id}}批次详情</span>
        </div>
      </template>
    </el-card>

    <el-card style="margin-top: 10px;">
      <template #header>
        <div class="card-header">
          <span>项目详情</span>
        </div>
      </template>
      <el-descriptions>
        <el-descriptions-item label="创建时间：">{{merTask?.merchantName}}</el-descriptions-item>
        <el-descriptions-item label="企业名称：">{{merTask?.merchantName}}</el-descriptions-item>
        <el-descriptions-item label="企业编号：">{{merTask.merNo}}</el-descriptions-item>
        <el-descriptions-item label="服务商名称：">{{merTask.gsmc}}</el-descriptions-item>
        <el-descriptions-item label="服务商编号：">{{merTask.id}}</el-descriptions-item>
        <el-descriptions-item label="项目名称：">{{merTask.name}}</el-descriptions-item>
        <el-descriptions-item label="项目金额：">{{merTask.cost}} ~ {{merTask.costMax}}</el-descriptions-item>
        <el-descriptions-item label="项目人数：">{{merTask.limitNum}}</el-descriptions-item>
        <el-descriptions-item label="所属行业：">{{merTask.industryName}}</el-descriptions-item>
        <el-descriptions-item label="所属子行业：">{{merTask.twoIndustryName}}</el-descriptions-item>
        <el-descriptions-item label="项目内容：">{{merTask.proContent}}</el-descriptions-item>
      </el-descriptions>
    </el-card>
    <el-card style="margin-top: 10px;">
      <template #header>
        <div class="card-header">
          <span>批次子明细</span>
        </div>
      </template>
      <el-table :data="logRecords">
        <el-table-column prop="createTime" label="创建时间"></el-table-column>
        <el-table-column prop="createTime" label="服务商名称"></el-table-column>
        <el-table-column prop="createTime" label="企业名称"></el-table-column>
        <el-table-column prop="createTime" label="批次号"></el-table-column>
        <el-table-column prop="createTime" label="交易流水号"></el-table-column>
        <el-table-column prop="createTime" label="结算账户"></el-table-column>
        <el-table-column prop="createTime" label="打款金额（元）"></el-table-column>
        <el-table-column prop="createTime" label="收款人"></el-table-column>
        <el-table-column prop="createTime" label="收款人身份证号"></el-table-column>
        <el-table-column prop="logDesc" label="收款人手机号"></el-table-column>
        <el-table-column prop="createRoleId" label="打款状态"></el-table-column>
      </el-table>
    </el-card>
    <el-card style="margin-top: 10px;">
      <template #header>
        <div class="card-header">
          <span>审批出款</span>
        </div>
      </template>
      <el-form>
        <el-form-item label="审核意见">
          <el-radio-group>
            <el-radio :label="1">通过</el-radio>
            <el-radio :label="2">拒绝</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="备注">
          <el-input></el-input>
        </el-form-item>
      </el-form>
    </el-card>
    <div class="footer">
      <el-button @click="$router.back()">返回</el-button>
      <el-button>提交</el-button>
    </div>
  </div>
</template>

<script lang="ts" setup>
const route = useRoute();

const pageLoading = ref(true)
const { proxy } = getCurrentInstance() as ComponentInternalInstance
/**
 * TODO
 * 查询角色信息字典
 * 回显label
 * 角色信息字典名称未知
*/
const list = toRefs<any>(proxy?.useDict("sys_role"));

/**
 * 项目状态
*/
const steps = computed(() => {
  const list = proxy?.useDict("task_status").task_status
  return list
})


// TODO 详情接口报错 没有访问权限，请联系管理员授权
const { data } = useRequest(`/payment/bill/${route.query.id}`, 'GET', {}, { immediate: true })

const merTask = computed(() => {
  return data?.value?.merTask || {}
})

const logRecords = computed(() => {
  return data?.value?.logRecords || []
})




onMounted(() => {
  setTimeout(() => {
      pageLoading.value = false
  }, 500);
})
</script>

<style scoped lang="scss">
.page-container {
  padding: 5px 15px 5px 10px;
  height: calc(100vh - 89px);
  overflow-y: auto;

  .footer {
    background: #fff;
    text-align: center;
    z-index: 999;
    margin-top: 20px;
  }
}
</style>
